package com.sky.mapper;

import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 判断id是否被套餐关联 批量判断
     * @param ids
     * @return
     */
    int countByDishIds(List<Long> ids);

    /**
     * 新增套餐
     * @param setmealDishes
     */
    void saveSetmealDishes(List<SetmealDish> setmealDishes);
/*8
起售中的套餐不能删除
 */
    void deleteBatch(List<Long> ids);

    /**
     * 根据id查询套餐
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id=#{id}")
    List<SetmealDish> getBySetmealId(Long id);

   /* @Select("select sd.name name ,sd.copies copies,d.image image , d.description description from setmeal_dish sd ,dish d \n" +
            "where sd.dish_id=d.id and sd.setmeal_id= #{id}")
    List<DishItemVO> selectDishVObySetmealId(Long id);*/
}
